using System;
using System.Collections.Generic;
//using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using LynxBlogAPI.Models;

namespace LynxBlogAPI.Controllers
{
    public class MediaController : ApiController
    {
        private LynxWebLog_Context db = new LynxWebLog_Context();

        // GET api/Media/5
        public FileContentResult GetMediaObjectData(Int32 id)
        {
            MediaObjectData media = db.MediaObjectDatas.Find(id);
            return media != null ? new FileContentResult(media.bits, media.type) : null;
        }

        protected override void Dispose(bool disposing)
        {
            db.Dispose();
            base.Dispose(disposing);
        }
    }
}